<%@ include file="/WEB-INF/jsp/common/include.jsp" %>
<%@ page pageEncoding="UTF-8"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<%@ taglib prefix="app" uri="AppTags" %>
<tiles:insertDefinition name="manageLayout.tiles">
  <tiles:putAttribute name="pageTitle">Хату.бы - Просмотр моего объявления</tiles:putAttribute>
  <tiles:putAttribute name="editTab" value="selected" cascade="true"/>
  <tiles:putAttribute name="manageBody" cascade="true">
    <div>
      <div class="box">
        <div class="box-container">
          <h2>Редактировать объявление</h2>
          <form:form commandName="flatAd" method="post" action="/ad/manage/edit.do">
            <form:hidden path="secureId"/>
            <spring:hasBindErrors name="flatAd">
              <p class="errorBlock">
                Исправьте ошибки
              </p>
            </spring:hasBindErrors>
            <table>
              <tr>
                <td><p><label for="price">Цена в месяц<span class="required">*</span>:</label></p></td>
                <td>
                  <p>
                    <form:input path="price"/> $
                    <form:errors path="price" cssClass="errorBlock"/>
                  </p>
                </td>
              </tr>
            </table>
            <p>
              <label for="description">Дополнительная информация:</label><br />
              <form:textarea path="description" rows="4" cols="100" />
              <form:errors path="description" cssClass="errorBlock"/>
            </p>
            <c:forEach var="imageType" items="${imageTypes}">
              <iframe src="/ad/manage/image/uploadedThumbnail.do?type=${imageType}&secureId=${param.secureId}&flatImageId=${flatAd.flatImages[imageType]}&editor=manage"
                      style="width : 800px; height : 180px; border : 0px"
                      marginheight="0" marginwidth="0" frameborder="0"
                      scrolling="no" overflow="hidden">
              </iframe>
            </c:forEach>

            <span class="button"><button type="submit">Сохранить</button></span>
            <c:url value="/ad/manage/view.do" var="cancelLink">
              <c:param name="secureId" value="${flatAd.secureId}"/>
            </c:url>
            <a href="${cancelLink}">Отмена</a>
          </form:form>
          <div class="cn tl"></div><div class="cn tr"></div>
        </div>
        <div class="cn bl"></div><div class="cn br"></div>
      </div>
    </div>
  </tiles:putAttribute>
</tiles:insertDefinition>